﻿using System;
using System.Linq;
using MartinRL.ProjectEuler.Sequences;

namespace MartinRL.ProjectEuler
{
    /// <summary>
    /// http://projecteuler.net/index.php?section=problems&id=2
    /// </summary>
    public static class Problem002
    {
         public static long FindTheSumOfTheEvenValuedTermsOfTheFibonacciSequenceWhoseValuesDoNotExceedFourMillion()
         {
             return FibonacciSequence.NewSequence()
                 .End(4000000)
                 .Where(t => t.IsEven())
                 .Sum();
         }
    }
}